home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
050
/
madtrb30.arc
/
SERTST.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-05-17
|
1KB
|
49 lines
{$U+,ISerial.pas}
{Obviously you have to have SERIAL.PAS on disk. See file SERIAL.PAS in this
XA }
Var
Port,Baud,StopBits,DataBits,Par: Integer;
Message: String[80];
Type
String19=String[19];
Function Binary(V: Integer): String19;
Var
I: Integer;
B: Array [0..3] Of String[4];
Begin
For I:=0 To 15 Do
If (V And (1 Shl (15-I)))<>0 Then B[I Div 4][(I Mod 4)+1]:='1'
Else B[I Div 4][(I Mod 4)+1]:='0';
For I:=0 To 3 Do B[I][0]:=Chr(4);
Binary:=B[0]+' '+B[1]+' '+B[2]+' '+B[3];
End;
Begin
Write('Enter port number: ');
ReadLn(Port);
AssignUsr(Port);
Write('Enter baud rate: ');
ReadLn(Baud);
Write('Enter stop bits: ');
ReadLn(StopBits);
Write('Enter data bits: ');
ReadLn(DataBits);
Write('Enter parity (0=none, 1=even, 2=odd): ');
ReadLn(Par);
Write('Enter message to print: ');
ReadLn(Message);
SetSerial(1,Baud,StopBits,DataBits,__ParityType(Par));
WriteLn(USR,Message);
WriteLn('OutError[',Port,']: ',Binary(OutError[Port]));
WriteLn('SerialStatus(',Port,'): ',Binary(SerialStatus(Port)));
End.